package com.lanchetech.admin.controller;

import com.lanchetech.admin.service.CatalogService;
import com.lanchetech.bean.response.ResultData;
import com.lanchetech.entity.Catalog;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api/catalog")
@Api(value = "经营品类",tags = "经营品类")
public class CatalogController {

    @Autowired
    private CatalogService cataLogService;


    @ApiOperation("获取所有经营品类")
    @PreAuthorize("hasAuthority('product.catalog')")
    @GetMapping("/getCatalogList")
    public ResultData<List<Catalog>> getCatalogList() {
        return cataLogService.getCatalogList();
    }

    @ApiOperation("获取上级经营品类")
    @GetMapping("/getChildren")
    public ResultData<List<Catalog>> getChildren(@RequestParam Long pId) {
        return null;
    }

}
